<template>
	<page-meta :page-style="$theme.pageStyle">
		<!-- #ifndef H5 -->
		<navigation-bar :front-color="$theme.navColor" :background-color="$theme.navBgColor" />
		<!-- #endif -->
	</page-meta>
	<view class="news-detail bg-white">
		<!-- 标题信心 -->
		<view class="news-detail-header py-[20rpx] px-[30rpx]">
			<view class="text-3xl font-medium mb-[25rpx]">{{ newsData.title }}</view>
			<view class="ins-card-content text-sm mb-[20rpx]">联系人：{{ newsData.name }}</view>
			<view class="ins-card-content text-sm mb-[20rpx]" @click="call_phone(newsData.phone)">联系电话：{{ newsData.phone }}</view>
			<view class="ins-card-content text-sm">地址：{{ newsData.address }}</view>
		</view>

		<!-- 咨询内容 -->
		<view class="news-detail-section bg-white p-[24rpx]">
			<!-- 内容 -->
			<view class="mt-[20rpx]">
				<u-parse :html="newsData.content"></u-parse>
			</view>
		</view>
		
		<view class="mt-[100rpx] mx-[26rpx]">
			<u-button type="primary" shape="circle" @click="submit">信息提交</u-button>
		</view>
		
		
	</view>
</template>

<script lang="ts" setup>
import { ref, reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { getTuangouDetail } from '@/api/shop';

const newsData = ref<any>({});
let bid = '';
let formData = reactive([]);

const getData = async (id) => {
	newsData.value = await getTuangouDetail({ id });
};
const call_phone = async (phone) => {
	uni.makePhoneCall({
		// 手机号
		phoneNumber: phone,
		// 成功回调
		success: (res) => {
			console.log('调用成功!');
		},
		// 失败回调
		fail: (res) => {
			console.log(res)
			console.log('调用失败!');
		}
	});
}

const submit = async () =>{
	uni.navigateTo({
		url:'/pages/insure/message?id='+bid
	})
}

onLoad((options: any) => {
	bid = options.id;
	getData(options.id);
});
</script>

<style lang="scss">
.news-detail {
	height: 100%;
	background: rgba(255, 255, 255, 0.95);

	&-header {
		border-bottom: 2rpx solid #f8f8f8;
	}
}
</style>
